package com.dmn.gcode.springchains.operators;

import com.dmn.gcode.springchains.core.AbstractOperator;
import com.dmn.gcode.springchains.core.IChainMaster;
import com.dmn.gcode.springchains.core.In;
import com.dmn.gcode.springchains.core.Out;

/**
 * date 17.01.11
 *
 * @author dvponomarev
 * @version 1.0
 */
public class CompareOperator extends AbstractOperator {
    //in
    private In<Double> multiplication;
    private In<Integer> intMultiplication;
    //out
    private Out<Boolean> outCompareResult;
    private Out<String> outCompareResultText;

    public void execute(IChainMaster chainMaster) throws Throwable {
        Boolean result = multiplication.get() > intMultiplication.get();
        outCompareResult.set(result);
        outCompareResultText.set(result.toString());
    }

    public void setMultiplication(In<Double> multiplication) {
        this.multiplication = multiplication;
    }

    public void setIntMultiplication(In<Integer> intMultiplication) {
        this.intMultiplication = intMultiplication;
    }

    public void setOutCompareResult(Out<Boolean> outCompareResult) {
        this.outCompareResult = outCompareResult;
    }

    public void setOutCompareResultText(Out<String> outCompareResultText) {
        this.outCompareResultText = outCompareResultText;
    }
}
